<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions" 
  xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
  xmlns:camunda="http://camunda.org/schema/1.0/bpmn"
  targetNamespace="Examples">
	
	<process id="compensateProcess" isExecutable="true">

		<startEvent id="start" />
		
		<sequenceFlow sourceRef="start"	targetRef="scope" />

		<subProcess id="scope">
		
			<multiInstanceLoopCharacteristics camunda:collection="flights" camunda:elementVariable="flight" isSequential="false" />

			<startEvent id="startInScope" />
			
			<sequenceFlow sourceRef="startInScope" targetRef="bookFlight" />

			<serviceTask id="bookFlight" 
				camunda:class="org.camunda.bpm.engine.test.bpmn.event.compensate.helper.BookFlightService" />

			<boundaryEvent id="compensateBookFlightEvt" name="Boundary event"
				attachedToRef="bookFlight">
				<compensateEventDefinition />
			</boundaryEvent>
			
			<serviceTask id="undoBookFlight" isForCompensation="true" 
					camunda:class="org.camunda.bpm.engine.test.bpmn.event.compensate.helper.CancelFlightService" />
			
			<sequenceFlow sourceRef="bookFlight" targetRef="endInScope" />
			
			<endEvent id="endInScope" />
			
			<association associationDirection="One" sourceRef="compensateBookFlightEvt" targetRef="undoBookFlight" />
						
		</subProcess>

		<sequenceFlow sourceRef="scope" targetRef="throwCompensate" />
		
		<intermediateThrowEvent id="throwCompensate">
			<compensateEventDefinition />
		</intermediateThrowEvent>
		
		<sequenceFlow sourceRef="throwCompensate" targetRef="end" />
		
		<endEvent id="end" />
	</process>

</definitions>
